home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kfilepreview.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  3.7 KB  |  123 lines

  1. /*  -*- c++ -*-
  2.     This file is part of the KDE libraries
  3.     Copyright (C) 1998 Stephan Kulow <coolo@kde.org>
  4.                   1998 Daniel Grana <grana@ie.iwi.unibe.ch>
  5.                   2000 Werner Trobin <wtrobin@carinthia.com>
  6.  
  7.     This library is free software; you can redistribute it and/or
  8.     modify it under the terms of the GNU Library General Public
  9.     License as published by the Free Software Foundation; either
  10.     version 2 of the License, or (at your option) any later version.
  11.  
  12.     This library is distributed in the hope that it will be useful,
  13.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.     Library General Public License for more details.
  16.  
  17.     You should have received a copy of the GNU Library General Public License
  18.     along with this library; see the file COPYING.LIB.  If not, write to
  19.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  20.     Boston, MA 02110-1301, USA.
  21. */
  22.  
  23. #ifndef _KFILEPREVIEW_H
  24. #define _KFILEPREVIEW_H
  25.  
  26. #include <qsplitter.h>
  27. #include <qwidget.h>
  28. #include <qstring.h>
  29.  
  30. #include <kurl.h>
  31. #include <kfileitem.h>
  32. #include <kfileiconview.h>
  33. #include <kfiledetailview.h>
  34. #include <kfile.h>
  35.  
  36. /*!
  37.  * This KFileView is an empbedded preview for some file types.
  38.  */
  39. class KIO_EXPORT KFilePreview : public QSplitter, public KFileView
  40. {
  41.     Q_OBJECT
  42.  
  43. public:
  44.     KFilePreview(QWidget *parent, const char *name);
  45.     KFilePreview(KFileView *view, QWidget *parent, const char *name);
  46.     virtual ~KFilePreview();
  47.  
  48.     virtual QWidget *widget() { return this; }
  49.     virtual void clearView();
  50.  
  51.     /**
  52.      * Delets the current view and sets the view to the given @p view.
  53.      * The view is reparented to have this as parent, if necessary.
  54.      */
  55.     void setFileView(KFileView *view);
  56.  
  57.     /**
  58.      * @returns the current fileview
  59.      */
  60.     KFileView* fileView() const { return left; }
  61.  
  62.     virtual void updateView( bool );
  63.     virtual void updateView(const KFileItem*);
  64.     virtual void removeItem(const KFileItem*);
  65.     virtual void listingCompleted();
  66.  
  67.     virtual void setSelectionMode( KFile::SelectionMode sm );
  68.  
  69.     virtual void setSelected(const KFileItem *, bool);
  70.     virtual bool isSelected( const KFileItem * ) const;
  71.     virtual void clearSelection();
  72.     virtual void selectAll();
  73.     virtual void invertSelection();
  74.  
  75.     virtual void insertItem(KFileItem *);
  76.     virtual void clear();
  77.  
  78.     virtual void setCurrentItem( const KFileItem * );
  79.     virtual KFileItem * currentFileItem() const;
  80.     virtual KFileItem * firstFileItem() const;
  81.     virtual KFileItem * nextItem( const KFileItem * ) const;
  82.     virtual KFileItem * prevItem( const KFileItem * ) const;
  83.  
  84.     virtual void setSorting( QDir::SortSpec sort );
  85.  
  86.     virtual void readConfig( KConfig *, const QString& group = QString::null );
  87.     virtual void writeConfig( KConfig *, const QString& group = QString::null);
  88.  
  89.     /**
  90.      * This overrides KFileView::actionCollection() by returning
  91.      * the actionCollection() of the KFileView (member left) it contains.
  92.      * This means that KFilePreview will never create a KActionCollection
  93.      * object of its own.
  94.      */
  95.     virtual KActionCollection * actionCollection() const;
  96.  
  97.     void ensureItemVisible(const KFileItem *);
  98.  
  99.     void setPreviewWidget(const QWidget *w, const KURL &u);
  100.  
  101. protected slots:
  102.     virtual void slotHighlighted( const KFileItem * );
  103.  
  104. signals:
  105.     void showPreview(const KURL &);
  106.     void clearPreview();
  107.  
  108. private:
  109.     void init( KFileView *view );
  110.  
  111.     KFileView *left;
  112.     QWidget *preview;
  113.     QString viewname;
  114.  
  115. protected:
  116.     /** \internal */
  117.     virtual void virtual_hook( int id, void* data );
  118. private:
  119.     class KFilePreviewPrivate;
  120.     KFilePreviewPrivate *d;
  121. };
  122. #endif
  123.